/**
 * Created by Administrator on 14-7-11.
 */
Imageup2={
    genePic:function(imgpath,selector,headselector,name)//生成图片框
    {
        if(!window.image_index)
            window.image_index=1;
        else
            window.image_index++;

        var img_path = 'images2';
        var description = name ? name : '';
        var img_name=img_path+"title";
        var content='<li class="img-li">';
        content+='<img class="fl" src="'+imgpath+'" width="100" height="100">';
        content+='<p class="p1"><input type="text" class="img-name" name="'+img_name+'['+window.image_index+']" style="width:90px" value="'+description+'" />';
        content+='<input type="hidden" class="img-path" name="'+img_path+'['+window.image_index+']" value="'+imgpath+'"/></p>';
        content+='<p class="p2">';
        content+='<span class="btn-closed" onclick="Imageup2.delImg(this,\''+imgpath+'\','+window.image_index+')"></span></p>';
        content+='</li>';
        $(selector).append(content);
    },
    /*
     * 删除图片
     *
     * */
    delImg:function(dom,path,index)
    {
        var headindex= $(".headimgindex2").val();
        if(headindex==index)
            $(".headimgindex2").val("");
        $(dom).parents(".img-li2").remove();

    },
    setHead:function(dom,index)
    {
        $("li .btn-ste2").removeAttr("style");

        $("li .btn-ste2").text("设为封面");
        $(dom).css("background","green");
        $(dom).css("display","block");
        $(dom).text("已设为封面");
        $(".headimgindex2").val(index);



        /* var pnode=$(dom).parents('.img-li').first();
         var imgpath=pnode.find('.img-path').val();
         var imgtitle=pnode.find('.img-title').val();
         var content='<ul class="head-img-ul"><li class="img-li"><img class="fl" src="'+imgpath+'" width="100" height="100"><p class="p1"><input type="text" class="img-name" name="headimgtitle" style="width:90px" /><input type="hidden" class="img-path" name="headimg" value="'+imgpath+'"/></p><p class="p2"><span class="btn-closed" onclick="Imageup.delImg(this,\''+imgpath+'\',1)"></span></p></li></ul>';
         $(headselector).html(content);
         */



    }





}
